package com.suray.wcs.service.rescontact;

import com.suray.commin.core.utils.SpringContextHolder;
import com.suray.wcs.service.pojo.RgvDirectionType;
import com.suray.basic.wcs.utils.typedef.BaseDataType;
import com.suray.wcs.service.system.entity.WareHouseDB;
import com.suray.wcs.service.system.service.impl.WareHouseDBServiceImpl;

import java.util.ArrayList;
import java.util.List;

public class MapRgvDirection  {
    private static WareHouseDBServiceImpl wareHouseDBService = SpringContextHolder.getBean(WareHouseDBServiceImpl.class);
    protected static List<RgvDirectionType> baseDatas = new ArrayList();

    public static void setRgvDirection(){
        WareHouseDB wareHouseDB = wareHouseDBService.getCurWareHouseDB();
        int mapDirection=wareHouseDB.getMapDirection();
        int right=0;
        int up=0;
        int lift=0;
        int down=0;
        switch (mapDirection){
            case 1:
                 right=2;
                 up=3;
                 lift=4;
                 down=1;
                break;
            case 2:
                right=3;
                up=4;
                lift=1;
                down=2;
                break;
            case 3:
                right=4;
                up=1;
                lift=2;
                down=3;
                break;
            case 4:
                right=1;
                up=2;
                lift=3;
                down=4;
                break;
            default:
                break;
        }
        baseDatas.add( new RgvDirectionType("右",right));
        baseDatas.add( new RgvDirectionType("上",up));
        baseDatas.add( new RgvDirectionType("左",lift));
        baseDatas.add( new RgvDirectionType("下",down));
    }

    public static Integer getValue(String name) {
        for (RgvDirectionType data : baseDatas) {
            if (data.getDirectionName().equals(name)) {
                return data.getCode();
            }
        }
        return null;
    }

}
